//
//  showTime.m
//  ElektroM
//
//  Created by Michael on 17.10.09.
//  Copyright 2009 Artgruppe inc. All rights reserved.
//

#import "showTime.h"
#import "dataBase.h"


@implementation showTime
@synthesize lblStationNames, lblStationNamesRev, lblStationTimes, lblStationTimesRev, backButton;
@synthesize namePrefix;
@synthesize startStation, endStation;


 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
		// self.title = NSLocalizedString(@"", @"");		
		//[backButton setTitle: NSLocalizedString(@"Back", @"")];
		//[btnFindStation setTitle: NSLocalizedString(@"FindStation", @"") forState:UIControlStateNormal];
		[self.view setNeedsDisplay];
    }
    return self;
}

-(IBAction) goHome
{
    [self.parentViewController dismissModalViewControllerAnimated:YES];		
}

-(IBAction) findStations
{
    /*
	if(_db==nil)
    {
	_db=[dataBase alloc];
	_db.namePrefix=namePrefix;
	_db.databaseName=[namePrefix stringByAppendingString:@"Railways.sqlite"];
    }

    [_db initialization];

    NSString* strStartTime1=[_db findTimeOfNearTrainWithFirstSt: startStation 
       						andSecondStation: endStation
						withDirection: 0];
    NSString* strEndTime1=[_db getDestinationTime];
	
	lblStationTimes.text = strStartTime1;
    lblStationTimeEnd.text = strEndTime1;


    NSString* strStartTime2=[_db findTimeOfNearTrainWithFirstSt: endStation   
					       andSecondStation: startStation
						withDirection: 1];
    NSString* strEndTime2=[_db getDestinationTime];
	    
    lblStationTimesRev.text = strStartTime2;
    lblStationTimeRevEnd.text = strEndTime2;
	 */
}

- (void)viewDidLoad {
    [self.backButton setTitle: NSLocalizedString(@"Back", @"")];
	[lblPaidApp setText: NSLocalizedString(@"PaidApp", @"")];
	[super viewDidLoad];
}


/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)viewWillAppear:(BOOL)animated{
	[self findStations];
}

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
	self.lblStationNames=nil;
	self.lblStationNamesRev=nil;	
	self.lblStationTimes=nil;
	self.lblStationTimesRev=nil;	
	self.backButton=nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
